home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_doom / deep870s.zip / SCRIPTS.DOC < prev    next >
Text File  |  1996-03-03  |  18KB  |  451 lines

  1.                      Understanding The HEXEN Script Code
  2.                      -----------------------------------
  3.                      And Making Action Scripts for HEXEN
  4.  
  5.                               By : Chris Becker
  6.  
  7.     --------
  8.     - NOTE -
  9.     --------
  10.  
  11.     This file is intended to be in the ZIP file that contains DeeP.
  12.     If you do not have DeeP or or use another editor, some of this 
  13.     information may not apply.
  14.  
  15.     If you do not have DeeP or use another editor, I greatly recommend 
  16.     that you use DeeP. It is probably the best DOOM_HERETIC_HEXEN editor 
  17.     there is. If you do have it and like it, please register!
  18.  
  19.  
  20.     ---------------------
  21.     - TABLE OF CONTENTS -
  22.     ---------------------
  23.  
  24.     I. Introduction
  25.       
  26.        1. What is an Action Script File?
  27.        2. What do I have to know?
  28.        3. What are the requirements?
  29.  
  30.     II. Understanding the Script Code and some commands
  31.  
  32.        4. The format of an Action Script file (an ACS file)
  33.        5. (void) and OPEN
  34.        6. LineSpecials
  35.        7. Constants
  36.        8. Printing Messages
  37.        9. DELAY
  38.       10. TAGWAIT
  39.       11. RANDOM
  40.       12. TERMINATE
  41.       13. The all-mighty Semi-Colon
  42.  
  43.     III. Conclusion
  44.  
  45.       14. A word to the Un-wise     
  46.       15. If you need help or want to learn more...      
  47.       16. Credits                  
  48.  
  49.  
  50.  
  51.                                  INTRODUCTION
  52.                                ________________
  53.  
  54.  
  55.      -------------------------------------
  56.      - 1. What is an Action Script File? -
  57.      -------------------------------------
  58.  
  59.     An Action Script File (ACS) is a set of actions for HEXEN to read. 
  60.     An ACS file isn't necessary for a HEXEN level. Scripts are used for
  61.     any kind of actions you want to happen that you can't do with 
  62.     just the standard LineDef specials. 
  63.     
  64.     For example, in a standard level, you would have a line that opens a 
  65.     door when you walk over it. This would not require a script, since you 
  66.     can do this with a standard LineDef type in the editor. But if you 
  67.     wanted the line to open a door, make an elevator go down, and have
  68.     the ceiling come down, this would require a script. One line
  69.     cannot do more than one different thing at a time.
  70.  
  71.  
  72.     ------------------------------
  73.     - 2. What do I have to know? -
  74.     ------------------------------
  75.  
  76.     Well you should know how to make a P-Wad fairly well and 
  77.     understand how that stuff works. If not, then I recommend that you     
  78.     take some time and learn the basics of level making. (Look in your     
  79.     DeeP text files for help on that.) If you know that stuff, this 
  80.     should be easy after you understand it. Other than that, that's all     
  81.     you should have to know.
  82.  
  83.     - NOTE - 
  84.     
  85.     I am also still learning this stuff and some of this stuff may not 
  86.     be totally the way a pro would do it. But the information in this 
  87.     document should be sufficient enough to start writing good scripts.
  88.  
  89.     (Note by SBS: And that's why we like it! The perspective of a beginner 
  90.     limits the discussion to essential elements.)
  91.  
  92.     -------------------
  93.     - 3. Requirements -
  94.     -------------------
  95.  
  96.     You should have DeeP (The DOOM_HERETIC_HEXEN editor) but if you 
  97.     don't you need some kind of utilities that will make the script and     
  98.     put the script into a wad file. And you need the EDIT program
  99.     usually found in your DOS directory. This is where you will be         
  100.     writing the scripts. You should also have HEXEN.
  101.  
  102.  
  103.  
  104.  
  105.  
  106.                    Understanding The HEXEN Script Code
  107.                  _______________________________________
  108.  
  109.                             And Some Commands
  110.  
  111.  
  112.      -------------------------------
  113.      - 4. The format of an ACS File-
  114.      -------------------------------
  115.  
  116.     The format of an ACS file is simple. This is one of the easiest 
  117.     parts of making ACS files. But these parts of an ACS are essential.
  118.     The file won't work if the format is not followed.
  119.  
  120.     Here is an example...
  121. _______________________________________________
  122.                                                |
  123. #include "common.acs"                          |
  124.                                                |
  125. Script 1 (void)                                |
  126. {                                              |
  127.     -YOUR COMMANDS HERE-                       |
  128. }                                              |
  129. _______________________________________________|
  130.  
  131.     The "#include "common.acs" line is needed to tell the script 
  132.     making program to include the file COMMON.ACS file. (The
  133.     COMMON.ACS file has a lot of information needed for items and
  134.     the different things you can do in HEXEN.)
  135.  
  136.     The "Script 1 (void)" line is self explanitory. This line tells
  137.     the script number your working on. The "(void)" part of this line
  138.     you will learn about later. If you're just starting, use this as a 
  139.     default.
  140.  
  141.     The "{" thing is used when you are ready to start putting commands     
  142.     in the script. The "}" thing means you are ready to stop puting        
  143.     in commands.    
  144.     
  145.     NOTE - If for any reason you need to use more than one of these, 
  146.     remember to align them on the same line (makes it easier to read)! 
  147.     Like this...
  148.  
  149. _______________________________________________
  150. {                                              |
  151.   {                                            |
  152.     -YOUR COMMANDS HERE-                       |
  153.   }                                            |
  154. }                                              |
  155. _______________________________________________|
  156.  
  157.     As you can see all "{" and "}" things are aligned on the same line. 
  158.     The "-YOUR COMMANDS HERE-" line tells where all your commands go.
  159.  
  160.  
  161.     ----------------------
  162.     - 5. (void) and OPEN -
  163.     ----------------------
  164.  
  165.     "(void)" and "OPEN" are simple. "(void)" means that there are no 
  166.     variables passed to the script. (You will learn about variables later
  167.     in this document.) For many scripts you use "(void)".
  168.  
  169.     You use "OPEN" when you want the script to run as soon as the  
  170.     game starts. Use this when you want to activate something in the 
  171.     beginning of the level. Examples are printing a message, playing
  172.     a sound track, lowering a floor, you know, all the fun stuff!
  173.  
  174.     -Look at the examples below...
  175.  
  176. ______________________________________________
  177.                                               |
  178. Script 1 (void)                               |  There are no Variables
  179. {                                             |  passed to this script.
  180.         -YOUR COMMANDS HERE-                  |  
  181. }                                             |  Use when starting out!   
  182. ______________________________________________|            
  183.  
  184.                        and
  185. ______________________________________________
  186.                                               |
  187. Script 1 OPEN                                 |  This script prints
  188. {                                             |      "Hi. I rule" 
  189.         print(s:"Hi. I rule");                |  when the game starts.  
  190. }                                             |
  191. ______________________________________________|
  192.  
  193.  
  194.     --------------------
  195.     - 6. Line Specials -
  196.     --------------------
  197.  
  198.     Line Specials are the meat of the script. These are the parts that
  199.     tell what's going to happen. Like let's say you wanted a floor to 
  200.     rise up after a line had been crossed. This is what it would 
  201.     look like...
  202.  
  203. ______________________________________________
  204. Script 1 (void)                               |
  205. {                                             |  This is telling HEXEN that
  206.         Floor_RaiseByValue(CONSTANTS);        |  you want a floor to rise
  207. }                                             |  by a certain value.
  208.                                               |  The (CONSTANTS) part is 
  209.                                               |  covered next.
  210. ______________________________________________|
  211.  
  212.     This is what most of your script will be made of, but with some other 
  213.     commands which are covered later.
  214.  
  215.     - NOTE -  
  216.     
  217.     There is a list of the Line Specials in the file SPECIALS.ACS included 
  218.     with DeeP.  You should probably print this out when writing scripts.
  219.  
  220.  
  221.     ----------------
  222.     - 7. Constants -
  223.     ----------------
  224.  
  225.     Constants are also very easy to understand. These are the different
  226.     options that a Line Special has. The Constants are displayed in the
  227.     line specials in DeeP. Usually they are TAG-NUMBER, SPEED, HEIGHT.
  228.     Look at the example...
  229.  
  230. ______________________________________________
  231. Script 1 (void)                               | The 1, 8, 32 part are the 
  232. {                                             | constants. 1 is the sector
  233.         Floor_RaiseByValue(const:1, 8, 32);   | tag (the area which you want
  234. }                                             | to raise). 8 is the speed at 
  235. ______________________________________________| which it raises and 32 is the
  236.                                                 height that it raises up.
  237.  
  238.     This script would raise the sector tagged 1 up 32 at the speed of 8.
  239.     This is pretty easy now right? 
  240.     
  241.     This is pretty much all that script making is about. But there are 
  242.     still some commands that you should learn.
  243.  
  244.  
  245.     ------------------------
  246.     - 8. Printing Messages -
  247.     ------------------------
  248.  
  249.     Printing messages is probably the easiest part of making scripts. I will
  250.     use "OPEN" instead of "(void)" for this. Doing this will print the 
  251.     message right when the game starts up.
  252.     Look at the example...
  253.  
  254. ______________________________________________
  255. Script 1 OPEN                                 | This is the format for
  256. {                                             | printing things. In place 
  257.         print(s:"HEXEN RULES!");              | of "HEXEN RULES!" you could
  258. }                                             | put anything, in CAPS of
  259. ______________________________________________| course. Don't worry about
  260.                                                 centering the messages, 
  261.                                                 HEXEN does it for you.
  262.                                                 
  263.  
  264.     This simple script just prints out "HEXEN RULES!" in the beginning
  265.     of the game. Its that easy.  Just don't forget to use only CAPITAL
  266.     letters.
  267.  
  268.  
  269.     ------------
  270.     - 9. DELAY -
  271.     ------------
  272.  
  273.     Delay is also one of the simplest commands. It's self-explanatory.
  274.     Delay is used for making a delay. Delay has one constant (like a 
  275.     choice) and that is how long of a delay.
  276.  
  277.     Look at the example...
  278.  
  279. ______________________________________________
  280. Script 1 (void)                               |  This raises a floor in the 
  281. {                                             |  sector with a tag of 1, 
  282.         Floor_RaiseByValue(const:1, 8, 32);   |  32 units at a speed of 8,  
  283.         Delay(const:24);                      |  then stop for 24 "tics".
  284.         Floor_LowerByValue(const:1, 8, 32);   |  Then the floor lowers 32 
  285. }                                             |  units at a speed of 8.
  286. ______________________________________________|
  287.  
  288.     All the delay command does is make the script wait. its as simple as 
  289.     that.
  290.  
  291.  
  292.     ---------------
  293.     - 10. TAGWAIT -
  294.     ---------------
  295.  
  296.     This is a simple little command that tells the program to wait until
  297.     that tagged part of the script is done with its part until it goes on.
  298.     Look at the example...
  299.  
  300. ______________________________________________
  301. Script 1 (void)                               |  This raises a floor 32 units
  302. {                                             |  at a speed of 8, waits for
  303.         Floor_RaiseByValue(const:1, 8, 32);   |  the sector tagged 1 to    
  304.         tagwait(const:1);                     |  finish its task (which is
  305.         Floor_LowerByValue(const:2, 8, 32);   |  to raise 32 at the speed
  306. }                                             |  of 8) and then the sector
  307. ______________________________________________|  tagged 2 would lower 32 at
  308.                                                  the speed of 8.
  309.     
  310.     Using "TAGWAIT" makes it so "Floor_Lower" can't go until "Floor_Raise" 
  311.     has finished.
  312.  
  313.  
  314.     ---------------
  315.     - 11. RESTART -
  316.     ---------------
  317.  
  318.     Another easy one. This just restarts the script that you put "RESTART" 
  319.     in. 
  320.     
  321.     Look at the example...
  322.  
  323. ______________________________________________
  324. Script 1 (void)                               | This raises the sector
  325. {                                             | tagged 1 up 32 at the speed
  326.         Floor_RaiseByValue(const:1, 8, 32);   | of 8. And the it would 
  327.         Restart;                              | restart the script which 
  328. }                                             | would just raise the sector
  329. ______________________________________________| tagged 1 up 32 at the speed
  330.                                                 of 8.
  331.  
  332.     "RESTART" just restarts the script. That simple!
  333.  
  334.  
  335.     --------------
  336.     - 12. RANDOM -
  337.     --------------
  338.  
  339.     "RANDOM" is easy just like the rest of them. Instead of putting a
  340.     constant, you could put a random number. This would make it not the same
  341.     all the time. 
  342.     
  343.     Look at the example...
  344.  
  345. ___________________________________________________________________
  346. Script 1 (void)                                                    |
  347. {                                                                  |
  348.         Floor_RaiseByValue(const:1, random(8, 16),random (32, 48); |
  349. }                                                                  |
  350. ___________________________________________________________________|
  351.  
  352.     This would raise the tagged sector up a number between 32 and 48 
  353.     (randomly picked by the computer) at a speed between 8 and 16 
  354.     (also randomly picked by the computer).
  355.  
  356.     This is all that "RANDOM" does and is a simple command.
  357.  
  358.  
  359.  
  360.     ---------------------------------
  361.     - 13. The all-mighty Semi-Colon -
  362.     ---------------------------------
  363.  
  364.     The semi-colon is used to end all commands. If the semi-colon is not
  365.     used then the script will not work. This is all you gotta do. 
  366.  
  367.     Look at the example...
  368.  
  369. ______________________________________________ 
  370. Script 1 (void)                               |
  371. {                                             | The semi-colon is used to
  372.         Floor_LowerByValue(const:1, 8, 32);   | end the line special and
  373. }                                             | then the script is ended.
  374.                                               |
  375. ______________________________________________|
  376.  
  377.     Just make sure to end every command with a semi-colon.
  378.  
  379.  
  380.  
  381.  
  382.                                 CONCLUSION
  383.                               --------------
  384.  
  385.  
  386.     ----------------------------
  387.     - 14. A word to the People -
  388.     ----------------------------
  389.  
  390.     To tell you again, this is not -ALL- of the information on how to make
  391.     scripts. There is a lot more than this and I am still trying to 
  392.     understand it all. My aim for this document was to get you started
  393.     and make you familiar with how a script works. 
  394.     
  395.     Well, I hope this document fullfilled it's purpose in getting you to 
  396.     understand scripts. If not, try going over this document again and if 
  397.     you still don't understand, then I am sorry to waste your time.
  398.  
  399.  
  400.     -------------------------------------------------------
  401.     - 15. If you still need help or want to learn more... -
  402.     -------------------------------------------------------
  403.  
  404.     If your still stumped on this stuff and wanna learn it, take some scripts 
  405.     from HEXEN yourself and spend some time trying to understand them like I
  406.     did. 
  407.     
  408.     Look at your DeeP text files to figure out how to build levels. And if 
  409.     you still can't figure this stuff out, then I don't know what to do. 
  410.     On the other hand, if you want to learn more, then take some scripts 
  411.     out of HEXEN and try to figure the stuff out.  Use the Decompile Script
  412.     option under File. This makes a text file from any level script.
  413.     
  414.     You can also use the PUKE cheat code to run the scripts while playing 
  415.     HEXEN. 
  416.     
  417.     Look at the example...
  418.  
  419.          PUKE 03
  420.  
  421.     This would run script 3 while playing HEXEN. (After you type PUKE it   
  422.     should prompt you for the script number. You must include the zero in
  423.     single digit numbers.)
  424.  
  425.     This might also help you in understanding in what the scripts do.
  426.     
  427.     I have also added a sample script file and a sample P-WAD that may 
  428.     explain things a little more. They are called SCRIPTS.WAD and 
  429.     SCRIPTS.ACS.  This P-WAD is not complete (I'm still working on it)
  430.     but the programers at Sensor Based Systems thought it would be a good
  431.     idea to include this for extra help.) yet so don't be alarmed to find
  432.     it's small. The sample script gives you some more examples of how the
  433.     scripts work. Both should give you a better understanding of how an 
  434.     ACS works.
  435.  
  436.      
  437.     ---------------
  438.     - 16. Credits -
  439.     ---------------
  440.  
  441.     I would like to thank the people at Sensor Based Systems for putting
  442.     up with my crap every time I called them. I also want to thank my
  443.     neighbors for letting me use their printer and using all their paper.
  444.     (My family is cheap, give me a break!) And my dad for getting off the 
  445.     damn computer when I needed to use it!
  446.  
  447.  
  448.                                 -------------
  449.                                 E  -  N  -  D
  450.                                 -------------
  451.